]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Handle number/phone input purposes specifically
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 26 Jan 2024 17:51:14 +0000 (18:51 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 29 Feb 2024 15:34:21 +0000 (16:34 +0100)
Add OSK keymaps for these, with the special keys necessary to
type numbers(positive, negative, fractional, ...) and phone numbers
(with */+/#)

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6550
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3162>

data/gnome-shell-osk-layouts.gresource.xml
data/osk-layouts/number.json [new file with mode: 0644]
data/osk-layouts/phone.json [new file with mode: 0644]
js/ui/keyboard.js

index efaf47491bdff3d908effb4b5645b324f0400784..57ad335474845cc01c8d98f75b6f6c4cd933b001 100644 (file)
@@ -44,7 +44,9 @@
     <file>my.json</file>
     <file>nl.json</file>
     <file>no.json</file>
+    <file>number.json</file>
     <file>ph.json</file>
+    <file>phone.json</file>
     <file>pl.json</file>
     <file>pt.json</file>
     <file>ro.json</file>
diff --git a/data/osk-layouts/number.json b/data/osk-layouts/number.json
new file mode 100644 (file)
index 0000000..db82fb7
--- /dev/null
@@ -0,0 +1,95 @@
+{
+  "levels": [
+    {
+      "level": "",
+      "mode": "default",
+      "rows": [
+        [
+          {
+            "strings": [
+              "7"
+            ]
+          },
+          {
+            "strings": [
+              "8"
+            ]
+          },
+          {
+            "strings": [
+              "9"
+            ]
+          },
+          {
+            "action": "delete",
+            "iconName": "edit-clear-symbolic"
+          }
+        ],
+        [
+          {
+            "strings": [
+              "4"
+            ]
+          },
+          {
+            "strings": [
+              "5"
+            ]
+          },
+          {
+            "strings": [
+              "6"
+            ]
+          },
+          {
+            "iconName": "keyboard-enter-symbolic",
+            "keyval": "0xff0d",
+            "height": 2
+          }
+        ],
+        [
+          {
+            "strings": [
+              "1"
+            ]
+          },
+          {
+            "strings": [
+              "2"
+            ]
+          },
+          {
+            "strings": [
+              "3"
+            ]
+          }
+        ],
+        [
+          {
+            "strings": [
+              "-",
+              "+",
+              "E"
+            ]
+          },
+          {
+            "strings": [
+              "0"
+            ]
+          },
+          {
+            "strings": [
+              ".",
+              ","
+            ]
+          },
+          {
+            "action": "hide",
+            "iconName": "keyboard-hide-symbolic"
+          }
+        ]
+      ]
+    }
+  ],
+  "name": "Numeric Keyboard"
+}
diff --git a/data/osk-layouts/phone.json b/data/osk-layouts/phone.json
new file mode 100644 (file)
index 0000000..0708d67
--- /dev/null
@@ -0,0 +1,93 @@
+{
+  "levels": [
+    {
+      "level": "",
+      "mode": "default",
+      "rows": [
+        [
+          {
+            "strings": [
+              "7"
+            ]
+          },
+          {
+            "strings": [
+              "8"
+            ]
+          },
+          {
+            "strings": [
+              "9"
+            ]
+          },
+          {
+            "action": "delete",
+            "iconName": "edit-clear-symbolic"
+          }
+        ],
+        [
+          {
+            "strings": [
+              "4"
+            ]
+          },
+          {
+            "strings": [
+              "5"
+            ]
+          },
+          {
+            "strings": [
+              "6"
+            ]
+          },
+          {
+            "iconName": "keyboard-enter-symbolic",
+            "keyval": "0xff0d",
+            "height": 2
+          }
+        ],
+        [
+          {
+            "strings": [
+              "1"
+            ]
+          },
+          {
+            "strings": [
+              "2"
+            ]
+          },
+          {
+            "strings": [
+              "3"
+            ]
+          }
+        ],
+        [
+          {
+            "strings": [
+              "*"
+            ]
+          },
+          {
+            "strings": [
+              "0",
+              "+"
+            ]
+          },
+          {
+            "strings": [
+              "#"
+            ]
+          },
+          {
+            "action": "hide",
+            "iconName": "keyboard-hide-symbolic"
+          }
+        ]
+      ]
+    }
+  ],
+  "name": "Phone"
+}
index 8f460bb52e4a0d8e5d41bac00f77548d9f69963a..f6b01c294a51acb12eddc8a54dedf3bd19edd602 100644 (file)
@@ -1391,10 +1391,12 @@ export const Keyboard = GObject.registerClass({
             y_expand: true,
         });
 
-        if (purpose === Clutter.InputContentPurpose.DIGITS ||
-            purpose === Clutter.InputContentPurpose.NUMBER ||
-            purpose === Clutter.InputContentPurpose.PHONE) {
+        if (purpose === Clutter.InputContentPurpose.DIGITS) {
             keyboardModel = new KeyboardModel('digits');
+        } else if (purpose === Clutter.InputContentPurpose.NUMBER) {
+            keyboardModel = new KeyboardModel('number');
+        } else if (purpose === Clutter.InputContentPurpose.PHONE) {
+            keyboardModel = new KeyboardModel('phone');
         } else {
             let groups = [groupName];
             if (groupName.includes('+'))